package com.example.zg.androidnewview.customView;

import android.app.Dialog;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.design.widget.BottomSheetDialogFragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;

import com.example.zg.androidnewview.R;

/**
 * 创建日期:2019/1/14 on 15:34
 * 描述：
 * 作者: zhougan
 */
public class MBottomSheetDialogFragment extends BottomSheetDialogFragment implements View.OnClickListener {
    private static final String TAG = "MBottomSheetDialogFrag";
    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view=inflater.inflate(R.layout.dialog_item,container,false);
        view.findViewById(R.id.item1).setOnClickListener(this);
        view.findViewById(R.id.item2).setOnClickListener(this);
        return view;
    }
    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.item1:
                Toast.makeText(getActivity(), "item1", Toast.LENGTH_SHORT).show();
                dismiss();
                break;
            case R.id.item2:
                Toast.makeText(getContext(), "item2", Toast.LENGTH_SHORT).show();


                dismiss();
                break;
        }
    }
}
